package au.com.evoCoach.dao;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import au.com.evoCoach.domain.Round;

@Repository
public class RoundDAO extends BaseDAO {

	public RoundDAO() {
		super(Round.class);
	}
	
	public Round getCurrentRound() {
	    
        String sql = "from Round where roundStatus in ('OPEN', 'PARTIAL_LOCKOUT', 'LOCKOUT')";
        Query query = getSession().createQuery(sql);
        
        return (Round) query.uniqueResult();        
	}
	
    public Round getRound(int round) {
        String sql = "from Round where round = :round";
        Query query = getSession().createQuery(sql);
        query.setParameter("round", round);
        
        return (Round) query.uniqueResult();        
    }	
	
}
